#!/usr/bin/env python3
"""
vcf_parser.py
提取 VCF 文件中的变异信息（仅解析注释列），输出为 TSV 格式
用法: python vcf_parser.py input.vcf output.tsv
"""
import sys

def parse_vcf(infile, outfile):
	with open(infile, 'r') as fin, open(outfile, 'w') as fout:
		fout.write("CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n")
		for line in fin:
			if line.startswith("#"):
				continue
			cols = line.strip().split("\t")
			fout.write("\t".join(cols[:8]) + "\n")

if __name__ == "__main__":
	if len(sys.argv) != 3:
		print("用法: python vcf_parser.py input.vcf output.tsv")
		sys.exit(1)
	parse_vcf(sys.argv[1], sys.argv[2])